import { IViewItem } from "@/types/IViewItem";

export class ViewItems {
  private static inistant: ViewItems;
  Groups: IViewItem[] = [];

  private constructor() {
    // 首页
    const homePage: IViewItem = {
      Name: "Home",
      Icon: "mdi-home",
      FilePath: "Home.vue",
      RoutePath: "/"
    };
    this.Groups.push(homePage);

    // 工厂模式
    const factoryPage1: IViewItem = {
      Name: "FactoryPage1",
      FilePath: "Factory/Page.vue",
      RoutePath: "/Factory/FactoryPage1"
    };
    const factoryPage2: IViewItem = {
      Name: "FactoryPage2",
      FilePath: "Factory/Page.vue",
      RoutePath: "/Factory/FactoryPage2"
    };
    const factoryPage3: IViewItem = {
      Name: "FactoryPage3",
      FilePath: "Factory/Page.vue",
      RoutePath: "/Factory/FactoryPage3"
    };
    const factoryPage4: IViewItem = {
      Name: "FactoryPage4",
      FilePath: "Factory/Page.vue",
      RoutePath: "/Factory/FactoryPage4"
    };

    const factory: IViewItem = {
      Name: "Factory",
      Icon: "mdi-factory",
      Items: [factoryPage1, factoryPage2, factoryPage3, factoryPage4]
    };

    this.Groups.push(factory);

    // 策略模式
    const strategyPage1: IViewItem = {
      Name: "StrategyPage1",
      FilePath: "Strategy/PageV1.vue",
      RoutePath: "/Strategy/PageV1"
    };
    const strategyPage2: IViewItem = {
      Name: "StrategyPage2",
      FilePath: "Strategy/PageV2.vue",
      RoutePath: "/Strategy/PageV2"
    };
    const strategyPage3: IViewItem = {
      Name: "StrategyPage3",
      FilePath: "Strategy/PageV3.vue",
      RoutePath: "/Strategy/PageV3"
    };
    const strategyPage4: IViewItem = {
      Name: "StrategyPage4",
      FilePath: "Strategy/PageV4.vue",
      RoutePath: "/Strategy/PageV4"
    };
    const strategyPage5: IViewItem = {
      Name: "StrategyPage5",
      FilePath: "Strategy/PageV5.vue",
      RoutePath: "/Strategy/PageV5"
    };

    const strategy: IViewItem = {
      Name: "Strategy",
      Icon: "mdi-strategy",
      Items: [
        strategyPage1,
        strategyPage2,
        strategyPage3,
        strategyPage4,
        strategyPage5
      ]
    };

    this.Groups.push(strategy);

    // 单一职责
    // const srpPage1: IViewItem = {
    //   Name: "SRPPage1",
    //   FilePath: "SRP/PageV1.vue",
    //   RoutePath: "/SRP/PageV1"
    // };
    // const srp: IViewItem = {
    //   Name: "SRP",
    //   Icon: "mdi-dialpad",
    //   Items: [srpPage1]
    // };
    //
    // this.Groups.push(srp);

    // 装饰器模式
    const decoratorPage1: IViewItem = {
      Name: "DecoratorPage1",
      FilePath: "Decorator/PageV1.vue",
      RoutePath: "/Decorator/PageV1"
    };
    const decoratorPage2: IViewItem = {
      Name: "DecoratorPage2",
      FilePath: "Decorator/PageV2.vue",
      RoutePath: "/Decorator/PageV2"
    };
    const decoratorPage3: IViewItem = {
      Name: "DecoratorPage3",
      FilePath: "Decorator/PageV3.vue",
      RoutePath: "/Decorator/PageV3"
    };
    const decoratorPage4: IViewItem = {
      Name: "DecoratorPage4",
      FilePath: "Decorator/PageV4.vue",
      RoutePath: "/Decorator/PageV4"
    };
    const decorator: IViewItem = {
      Name: "Decorator",
      Icon: "mdi-tshirt-crew",
      Items: [decoratorPage1, decoratorPage2, decoratorPage3, decoratorPage4]
    };

    this.Groups.push(decorator);

    // 代理模式
    const proxyPage1: IViewItem = {
      Name: "ProxyPage1",
      FilePath: "Proxy/PageV1.vue",
      RoutePath: "/Proxy/PageV1"
    };

    const proxyPage2: IViewItem = {
      Name: "ProxyPage2",
      FilePath: "Proxy/PageV2.vue",
      RoutePath: "/Proxy/PageV2"
    };
    const proxyPage3: IViewItem = {
      Name: "ProxyPage3",
      FilePath: "Proxy/PageV3.vue",
      RoutePath: "/Proxy/PageV3"
    };
    const proxy: IViewItem = {
      Name: "Proxy",
      Icon: "mdi-",
      Items: [proxyPage1, proxyPage2, proxyPage3]
    };

    this.Groups.push(proxy);
  }

  public static GetInstance(): ViewItems {
    if (!ViewItems.inistant) {
      ViewItems.inistant = new ViewItems();
    }
    return ViewItems.inistant;
  }
}
